package Fly;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;

public class ImageDemo extends JPanel {
  public void paint(Graphics g){
      BufferedImage background = null;
      BufferedImage hero0 = null;
      BufferedImage hero1 = null;
      BufferedImage bee = null;
      BufferedImage airplane = null;
      BufferedImage bigplane = null;
      BufferedImage bullet = null;
      BufferedImage gameover = null;
      BufferedImage pause = null;
      BufferedImage start = null;
      try {
          background = ImageIO.read(ImageDemo.class.getResourceAsStream("pic/background.png"));
          hero0=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/hero0.png"));
          hero1=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/hero1.png"));
          bee=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/bee.png"));
          airplane=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/airplane.png"));
          bigplane=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/bigplane.png"));
          bullet=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/bullet.png"));
          gameover=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/gameover.png"));
          pause=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/pause.png"));
          start=ImageIO.read(ImageDemo.class.getResourceAsStream("pic/start.png"));
      } catch (IOException e) {
          throw new RuntimeException(e);
      }
      //画图片
      g.drawImage(background,0,0,null);
  }
}
